@extends('layouts._app')
@section('content')
    <body>
    <div class="wrap-container">
        <div class="column-content-detail">
            <div class="col-lg-12">
                <div class="email-content" style="overflow:auto; width:100%;">
                    {!! Form::open(['class'=>'layui-form']) !!}
                    <div class="layui-form-item">
                        <div class="layui-input-inline tool-btn">
                            <a class="layui-btn layui-btn-small layui-btn-primary" id='email-refresh-btn'
                               href="{{route('expansion.recycle.index')}}?status={{$request['status']}}"
                               data-title='刷新'>
                                <i class="layui-icon">&#x1002;</i>
                            </a>
                            <button class="layui-btn layui-btn-small layui-btn-normal shareBth hidden-xs">
                                <i class="layui-icon">&#x1005;</i>
                            </button>
                            <button class="layui-btn layui-btn-small layui-btn-danger destroyBth hidden-xs">
                                <i class="layui-icon">&#xe640;</i>
                            </button>
                        </div>
                        <div class="layui-input-inline">
                            <select id="change_category" lay-filter="category" lay-search>
                                <option value="article" @if($request['status'] == 'article') selected @endif>文章</option>
                                <option value="blogUser" @if($request['status'] == 'blogUser') selected @endif>前台用户
                                </option>
                                <option value="user" @if($request['status'] == 'user') selected @endif>后台用户</option>
                                <option value="feedback" @if($request['status'] == 'feedback') selected @endif>意见反馈
                                </option>
                                <option value="gallery" @if($request['status'] == 'gallery') selected @endif>图片集锦
                                </option>
                                <option value="file" @if($request['status'] == 'file') selected @endif>图片</option>
                            </select>
                        </div>
                    </div>
                    {!! Form::close() !!}
                    @include('layouts._flash')
                    <div class="layui-form" id="table-list">
                        @if($request['status'] == 'article')
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
                                    <th>ID</th>
                                    <th>用户ID</th>
                                    <th>用户名</th>
                                    <th>标题</th>
                                    <th>封面图</th>
                                    <th>是否评论</th>
                                    <th>标签</th>
                                    <th>分类</th>
                                    <th>子分类</th>
                                    <th>浏览数</th>
                                    <th>评论数</th>
                                    <th>分享</th>
                                    <th>喜欢</th>
                                    <th>踩</th>
                                    <th>是否置顶</th>
                                    <th>状态</th>
                                    <th>删除时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($recycle as $value)
                                    <tr>
                                        <td><input type="checkbox" name="del" lay-skin="primary"
                                                   data-id="{{$value->id}}">
                                        </td>
                                        <td title="{{$value->id}}">{{$value->id}}</td>
                                        <td title="{{$value->user_id}}">{{$value->user_id}}</td>
                                        <td title="{{$value->user->name}}">{{$value->user->name}}</td>
                                        <td title="{{$value->title}}">{{sub($value->title,20)}}</td>
                                        <td title="{{$value->title}}">@if(isset($value->file->url))
                                                <img src="{{$value->file->url}}" style="width: 100px;"
                                                     alt="{{$value->title}}">
                                            @endif</td>
                                        <td title="{{$value->is == 1 ? '允许':'禁止'}}">{{$value->is == 1 ? '允许':'禁止'}}</td>
                                        <td>
                                            @foreach($value->articleLabel as $v)
                                                <a class="layui-btn layui-btn-mini layui-btn-normal"
                                                   href="javascript:void(0);">{{$v->name}}</a>
                                            @endforeach
                                        </td>
                                        <td title="{{$value->category->name ?? ''}}">{{sub($value->category->name ?? '',20)}}</td>
                                        <td title="{{$value->parent->name ?? ''}}">{{sub($value->parent->name ?? '',20)}}</td>
                                        <td title="{{$value->browse}}">{{sub($value->browse,20)}}</td>
                                        <td title="{{$value->comment}}">{{$value->comment}}</td>
                                        <td title="{{$value->share}}">{{sub($value->share,20)}}</td>
                                        <td title="{{$value->like}}">{{sub($value->like,20)}}</td>
                                        <td title="{{$value->step}}">{{sub($value->step,20)}}</td>
                                        <td title="{{$value->root == 1 ? '否' : '是'}}">{{$value->root == 1 ? '否' : '是'}}</td>
                                        <td title="{{config('articleConfig')[$value->status]}}">{{config('articleConfig')[$value->status]}}</td>
                                        <td>{{$value->deleted_at}}</td>
                                        <td>
                                            <div class="layui-inline">
                                                <a class="layui-btn layui-btn-small layui-btn-normal share"
                                                   data-id="{{$value->id}}"
                                                   href="javascript:void(0);">
                                                    <i class="layui-icon">&#x1005;</i></a>
                                                <a class="layui-btn layui-btn-small layui-btn-danger destroy"
                                                   href="javascript:void(0);"
                                                   data-id="{{$value->id}}">
                                                    <i class="layui-icon">&#xe640;</i></a>
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        @elseif($request['status'] == 'user')
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
                                    <th>ID</th>
                                    <th>用户名</th>
                                    <th>邮箱</th>
                                    <th>手机号</th>
                                    <th>状态</th>
                                    <th>头像</th>
                                    <th>用户组</th>
                                    <th>真实姓名</th>
                                    <th>备注</th>
                                    <th>删除时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($recycle as $value)
                                    <tr>
                                        <td><input type="checkbox" name="del" lay-skin="primary"
                                                   data-id="{{$value->id}}">
                                        </td>
                                        <td title="{{$value->id}}">{{$value->id}}</td>
                                        <td title="{{$value->name}}">{{$value->name}}</td>
                                        <td title="{{$value->email}}">{{sub($value->email,20)}}</td>
                                        <td title="{{$value->phone}}">{{sub($value->phone,20)}}</td>
                                        <td title="{{$value->static == 1 ? '正常' : '禁用'}}">{{$value->static == 1 ? '正常' : '禁用'}}</td>
                                        <td title="{{$value->name}}">@if(isset($value->info->file->url))
                                                <img src="{{$value->info->file->url}}" style="width: 100px;"
                                                     alt="{{$value->name}}">
                                            @endif</td>
                                        <td title="{{$value->roles->implode('name','， ')}}">{{sub($value->roles->implode('name','， '))}}</td>
                                        <td title="{{$value->rename}}">{{sub($value->rename,20)}}</td>
                                        <td title="{{$value->content}}">{{sub($value->content,20)}}</td>
                                        <td>{{$value->deleted_at}}</td>
                                        <td>
                                            <div class="layui-inline">
                                                <a class="layui-btn layui-btn-small layui-btn-normal share"
                                                   data-id="{{$value->id}}"
                                                   href="javascript:void(0);">
                                                    <i class="layui-icon">&#x1005;</i></a>
                                                <a class="layui-btn layui-btn-small layui-btn-danger destroy"
                                                   href="javascript:void(0);"
                                                   data-id="{{$value->id}}">
                                                    <i class="layui-icon">&#xe640;</i></a>
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        @elseif($request['status'] == 'blogUser')
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
                                    <th>ID</th>
                                    <th>账号</th>
                                    <th>邮箱</th>
                                    <th>手机号</th>
                                    <th>真实姓名</th>
                                    <th>昵称</th>
                                    <th>身份证</th>
                                    <th>备注</th>
                                    <th>头像</th>
                                    <th>出身日期</th>
                                    <th>生肖</th>
                                    <th>星座</th>
                                    <th>地址</th>
                                    <th>邀请码</th>
                                    <th>登陆次数</th>
                                    <th>微信openid</th>
                                    <th>github</th>
                                    <th>性别</th>
                                    <th>删除时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($recycle as $value)
                                    <tr>
                                        <td><input type="checkbox" name="del" lay-skin="primary"
                                                   data-id="{{$value->id}}">
                                        </td>
                                        <td title="{{$value->id}}">{{$value->id}}</td>
                                        <td title="{{$value->name}}">{{$value->name}}</td>
                                        <td title="{{$value->email}}">{{sub($value->email,20)}}</td>
                                        <td title="{{$value->phone}}">{{sub($value->phone,20)}}</td>
                                        <td title="{{$value->info->rename}}">{{$value->info->rename}}</td>
                                        <td title="{{$value->info->username}}">{{sub($value->info->username,5)}}</td>
                                        <td title="{{$value->info->card}}">{{sub($value->info->card,5)}}</td>
                                        <td title="{{$value->info->content}}">{{sub($value->info->content,5)}}</td>
                                        <td align="center"
                                            title="{{$value->name}}">@if(isset($value->info->file->url))<img
                                                style="margin:-10px;width: 60px;height: 60px;border-radius: 50%;"
                                                src="{{ assetImage($value->info->file->url)}}"
                                                alt="{{$value->name}}">@endif</td>
                                        <td title="{{$value->info->birthday}}">{{$value->info->birthday}}</td>
                                        <td title="{{$value->info->zodiac}}">{{$value->info->zodiac}}</td>
                                        <td title="{{$value->info->constellation}}">{{$value->info->constellation}}</td>
                                        <td title="{{$value->region}}">{{sub($value->region,5)}}</td>
                                        <td title="{{$value->info->code}}">{{sub($value->info->code)}}</td>
                                        <td title="{{$value->info->frequency}}">{{sub($value->info->frequency)}}</td>
                                        <td title="{{$value->info->openid}}">{{sub($value->info->openid)}}</td>
                                        <td title="{{$value->info->github}}">{{sub($value->info->github)}}</td>
                                        <td title="{{$value->info->sex == 1 ? '男' : '女'}}">{{$value->info->sex == 1 ? '男' : '女'}}</td>
                                        <td>{{$value->deleted_at}}</td>
                                        <td>
                                            <div class="layui-inline">
                                                <a class="layui-btn layui-btn-small layui-btn-normal share"
                                                   data-id="{{$value->id}}"
                                                   href="javascript:void(0);">
                                                    <i class="layui-icon">&#x1005;</i></a>
                                                <a class="layui-btn layui-btn-small layui-btn-danger destroy"
                                                   href="javascript:void(0);"
                                                   data-id="{{$value->id}}">
                                                    <i class="layui-icon">&#xe640;</i></a>
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        @elseif($request['status'] == 'feedback')
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
                                    <th>ID</th>
                                    <th>用户ID</th>
                                    <th>用户名</th>
                                    <th>分类</th>
                                    <th>二级分类</th>
                                    <th>联系方式</th>
                                    <th>图片</th>
                                    <th>内容</th>
                                    <th>出网ip</th>
                                    <th>出网国家</th>
                                    <th>出网地区</th>
                                    <th>出网省</th>
                                    <th>出网市</th>
                                    <th>出网县</th>
                                    <th>处理回复消息</th>
                                    <th>时间</th>
                                    <th>当前状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($recycle as $value)
                                    <tr data-id="{{$value->id}}">
                                        <td><input type="checkbox" name="del" lay-skin="primary"
                                                   data-id="{{$value->id}}">
                                        </td>
                                        <td title="{{$value->id}}">{{$value->id}}</td>
                                        <td title="@if(!$value->user) 未知 @else {{$value->user->name}}@endif">@if(!$value->user)
                                                未知 @else {{$value->user_id}}@endif</td>
                                        <td title="@if(!$value->user) 未知 @else {{$value->user->name}}@endif">@if(!$value->user)
                                                未知 @else {{$value->user->name}}@endif</td>
                                        <td title="{{$value->category->name ?? '无'}}">{{sub($value->category->name ?? '无',20)}}</td>
                                        <td title="{{$value->parent->name ?? '无'}}">{{sub($value->parent->name ?? '无',20)}}</td>
                                        <td title="{{$value->phone}}">{{sub($value->phone,20)}}</td>
                                        <td title="{{$value->content}}"
                                            id="layer-photos-demo">@if(!$value->pic->isEmpty())
                                                @foreach($value->pic as $pic)
                                                    <img style="height: 60px;"
                                                         src="{{ assetImage($pic->url)}}"
                                                         alt="{{$pic->filename}}">
                                                @endforeach @endif</td>
                                        <td title="{{$value->content}}">{{sub($value->content,20)}}</td>
                                        <td title="{{$value->ip}}">{{sub($value->ip,20)}}</td>
                                        <td title="{{$value->country}}">{{sub($value->country,20)}}</td>
                                        <td title="{{$value->area}}">{{sub($value->area,20)}}</td>
                                        <td title="{{$value->region}}">{{sub($value->region,20)}}</td>
                                        <td title="{{$value->city}}">{{sub($value->city,20)}}</td>
                                        <td title="{{$value->county}}">{{sub($value->county,20)}}</td>
                                        <td title="{{$value->fail}}">{{sub($value->fail,20)}}</td>
                                        <td title="{{$value->updated_at}}">{{sub($value->updated_at,20)}}</td>
                                        <td title="{{config('articleFeedback')[$value->static]['title']}}">
                                            {{config('articleFeedback')[$value->static]['title']}}
                                        </td>
                                        <td>
                                            <div class="layui-inline">
                                                <a class="layui-btn layui-btn-small layui-btn-normal share"
                                                   data-id="{{$value->id}}"
                                                   href="javascript:void(0);">
                                                    <i class="layui-icon">&#x1005;</i></a>
                                                <a class="layui-btn layui-btn-small layui-btn-danger destroy"
                                                   href="javascript:void(0);"
                                                   data-id="{{$value->id}}">
                                                    <i class="layui-icon">&#xe640;</i></a>
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        @elseif($request['status'] == 'gallery')
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
                                    <th>ID</th>
                                    <th>用户ID</th>
                                    <th>用户名</th>
                                    <th>标题</th>
                                    <th>封面图</th>
                                    <th>分类</th>
                                    <th>浏览数</th>
                                    <th>评论数</th>
                                    <th>分享</th>
                                    <th>喜欢</th>
                                    <th>踩</th>
                                    <th>是否置顶</th>
                                    <th>是否评论</th>
                                    <th>状态</th>
                                    <th>失败原因</th>
                                    <th>创建时间</th>
                                    <th>当前状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($recycle as $value)
                                    <tr>
                                        <td><input type="checkbox" name="del" lay-skin="primary"
                                                   data-id="{{$value->id}}">
                                        </td>
                                        <td>{{$value->id}}</td>
                                        <td>{{$value->user_id}}</td>
                                        <td title="{{$value->user->name ?? ''}}">{{$value->user->name ?? ''}}</td>
                                        <td title="{{$value->title}}">{{sub($value->title,20)}}</td>
                                        <td title="{{$value->title}}">
                                            @if(isset($value->file->url))
                                                <img src="{{$value->file->url}}" style="width: 100px;"
                                                     alt="{{$value->title}}">
                                            @endif
                                        </td>
                                        <td title="{{$value->category->name ?? ''}}">{{sub($value->category->name ?? '',20)}}</td>
                                        <td title="{{$value->browse}}">{{sub($value->browse,20)}}</td>
                                        <td title="{{$value->comment}}">{{sub($value->comment,20)}}</td>
                                        <td title="{{$value->share}}">{{sub($value->share,20)}}</td>
                                        <td title="{{$value->like}}">{{sub($value->like,20)}}</td>
                                        <td title="{{$value->step}}">{{sub($value->step,20)}}</td>
                                        <td title="{{$value->root == 1 ? '否' : '是'}}">{{$value->root == 1 ? '否' : '是'}}</td>
                                        <td title="{{$value->is == 1 ? '允许':'禁止'}}">{{$value->is == 1 ? '允许':'禁止'}}</td>
                                        <td title="{{$value->status == 1 ? '待审核' : ($value->status == 2 ? '审核成功':'审核失败')}}">{{$value->status == 1 ? '待审核' : ($value->status == 2 ? '审核成功':'审核失败')}}</td>
                                        <td title="{{$value->fail ?: '无'}}">{{sub($value->fail ?: '无',20)}}</td>
                                        <td title="{{$value->created_at}}">{{sub($value->created_at,20)}}</td>
                                        <td title="@if($value->is_show == 1) 显示 @else 隐藏 @endif">
                                            @if($value->is_show == 1) 显示 @else 隐藏 @endif
                                        </td>
                                        <td>
                                            <div class="layui-inline">
                                                <a class="layui-btn layui-btn-small layui-btn-normal share"
                                                   data-id="{{$value->id}}"
                                                   href="javascript:void(0);">
                                                    <i class="layui-icon">&#x1005;</i></a>
                                                <a class="layui-btn layui-btn-small layui-btn-danger destroy"
                                                   href="javascript:void(0);"
                                                   data-id="{{$value->id}}">
                                                    <i class="layui-icon">&#xe640;</i></a>
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        @elseif($request['status'] == 'file')
                            <table class="layui-table" lay-even lay-skin="nob">
                                <thead>
                                <tr>
                                    <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose">
                                    </th>
                                    <th>文件名</th>
                                    <th>大小</th>
                                    <th>HASH</th>
                                    <th>本地文件位置</th>
                                    <th>文件</th>
                                    <th>原图片</th>
                                    <th>时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($recycle as $value)
                                    <tr>
                                        <td><input type="checkbox" data-id="{{$value->id}}" name="del"
                                                   lay-skin="primary"></td>
                                        <td title="{{$value->name}}">{{sub($value->name)}}</td>
                                        <td title="{{$value->size}}">{{sub($value->size)}}</td>
                                        <td title="{{$value->hash}}">{{sub($value->hash)}}</td>
                                        <td title="{{$value->file_url}}">{{sub($value->file_url)}}</td>
                                        <td title="{{$value->name}}"><img src="{{assetImage($value->url)}}"
                                                                          width="100px" alt="{{$value->name}}"></td>
                                        <td title="{{$value->name}}">@if($value->primary)<img
                                                src="{{assetImage($value->primary->url)}}"
                                                width="100px" alt="{{$value->name}}">@endif</td>
                                        <td title="{{$value->created_at}}">{{sub($value->created_at)}}</td>
                                        <td>
                                            <div class="layui-inline">
                                                <a class="layui-btn layui-btn-small layui-btn-normal share"
                                                   data-id="{{$value->id}}"
                                                   href="javascript:void(0);">
                                                    <i class="layui-icon">&#x1005;</i></a>
                                                <a class="layui-btn layui-btn-small layui-btn-danger destroy"
                                                   href="javascript:void(0);"
                                                   data-id="{{$value->id}}">
                                                    <i class="layui-icon">&#xe640;</i></a>
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                    @endif
                    <!--tp分页-->
                        <div class="page-wrap">
                            <p style="float: left;">注 : 共 {{$recycle->total()}} 条记录</p>
                            {{ $recycle->links() }}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="{{asset('static/admin/layui/layui.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('static/admin/js/common.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('js/jquery.min.js')}}" type="text/javascript" charset="utf-8"></script>
    <script>
        layui.use(['form', 'dialog'], function () {
            var form = layui.form();
            var dialog = layui.dialog;
            form.on('select(category)', function (e) {
                window.location.href = "{{route('expansion.recycle.index')}}?status=" + e.value;
            })
            /**
             * 跨域
             */
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
            //顶部批量还原
            $('.shareBth').click(function () {
                var ids = [];
                $("input[name='del']:checked").each(function (i) {
                    ids[i] = $(this).data('id');
                });
                if (ids.length == 0) {
                    layer.msg('请选择要还原的', {icon: 5, time: 3000});
                    return false;
                }
                dialog.confirm({
                    message: '您确定要还原选中项',
                    success: function () {
                        $.ajax({
                            type: 'PATCH',
                            url: '{{route('expansion.recycle.reduction')}}',
                            data: {id: ids, status: '{{$request['status']}}', filter: true},
                            dataType: "json",
                            beforeSend: function () {
                                layer.load(1, {
                                    shade: [0.1, '#333333'] //0.1透明度的白色背景
                                });
                            },
                            complete: function (XHR) {
                                XHR = null;
                            },
                            error: function (xhr) {//获取ajax的错误信息
                                layer.alert(xhr.responseText, "Failed", function () {
                                    layer.closeAll();
                                });
                            },
                            success: function (res) {
                                layer.closeAll();
                                if (res.code == 403) {
                                    layer.msg(res.msg, {icon: 4, time: 3000})
                                    return false;
                                }
                                if (res.code != 200) {
                                    layer.msg(res.msg, {icon: 5, time: 3000})
                                    return false;
                                }
                                layer.msg(res.msg, {icon: 1, time: 3000}, function () {
                                    window.location.reload();
                                });
                            }
                        })
                    },
                    cancel: function () {
                        return false;
                    }
                })
                return false;

            }).mouseenter(function () {

                dialog.tips('批量还原', '.shareBth');

            })

            //顶部批量还原
            $('.share').click(function () {
                var ids = [$(this).data('id')];
                dialog.confirm({
                    message: '您确定要还原',
                    success: function () {
                        $.ajax({
                            type: 'PATCH',
                            url: '{{route('expansion.recycle.reduction')}}',
                            data: {id: ids, status: '{{$request['status']}}', filter: true},
                            dataType: "json",
                            beforeSend: function () {
                                layer.load(1, {
                                    shade: [0.1, '#333333'] //0.1透明度的白色背景
                                });
                            },
                            complete: function (XHR) {
                                XHR = null;
                            },
                            error: function (xhr) {//获取ajax的错误信息
                                layer.alert(xhr.responseText, "Failed", function () {
                                    layer.closeAll();
                                });
                            },
                            success: function (res) {
                                layer.closeAll();
                                if (res.code == 403) {
                                    layer.msg(res.msg, {icon: 4, time: 3000})
                                    return false;
                                }
                                if (res.code != 200) {
                                    layer.msg(res.msg, {icon: 5, time: 3000})
                                    return false;
                                }
                                layer.msg(res.msg, {icon: 1, time: 3000}, function () {
                                    window.location.reload();
                                });
                            }
                        })
                    },
                    cancel: function () {
                        return false;
                    }
                })
                return false;

            })

            //顶部批量删除
            $('.destroyBth').click(function () {
                var ids = [];
                $("input[name='del']:checked").each(function (i) {
                    ids[i] = $(this).data('id');
                });
                if (ids.length == 0) {
                    layer.msg('请选择要删除的', {icon: 5, time: 3000});
                    return false;
                }
                dialog.confirm({
                    message: '您确定要删除选中项',
                    success: function () {
                        $.ajax({
                            type: 'PATCH',
                            url: '{{route('expansion.recycle.destroy')}}',
                            data: {id: ids, status: '{{$request['status']}}', filter: true},
                            dataType: "json",
                            beforeSend: function () {
                                layer.load(1, {
                                    shade: [0.1, '#333333'] //0.1透明度的白色背景
                                });
                            },
                            complete: function (XHR) {
                                XHR = null;
                            },
                            error: function (xhr) {//获取ajax的错误信息
                                layer.alert(xhr.responseText, "Failed", function () {
                                    layer.closeAll();
                                });
                            },
                            success: function (res) {
                                layer.closeAll();
                                if (res.code == 403) {
                                    layer.msg(res.msg, {icon: 4, time: 3000})
                                    return false;
                                }
                                if (res.code != 200) {
                                    layer.msg(res.msg, {icon: 5, time: 3000})
                                    return false;
                                }
                                layer.msg(res.msg, {icon: 1, time: 3000}, function () {
                                    window.location.reload();
                                });
                            }
                        })
                    },
                    cancel: function () {
                        return false;
                    }
                })
                return false;

            }).mouseenter(function () {

                dialog.tips('批量删除', '.destroyBth');

            })

            //顶部批量还原
            $('.destroy').click(function () {
                var ids = [$(this).data('id')];
                dialog.confirm({
                    message: '您确定要删除',
                    success: function () {
                        $.ajax({
                            type: 'PATCH',
                            url: '{{route('expansion.recycle.destroy')}}',
                            data: {id: ids, status: '{{$request['status']}}', filter: true},
                            dataType: "json",
                            beforeSend: function () {
                                layer.load(1, {
                                    shade: [0.1, '#333333'] //0.1透明度的白色背景
                                });
                            },
                            complete: function (XHR) {
                                XHR = null;
                            },
                            error: function (xhr) {//获取ajax的错误信息
                                layer.alert(xhr.responseText, "Failed", function () {
                                    layer.closeAll();
                                });
                            },
                            success: function (res) {
                                layer.closeAll();
                                if (res.code == 403) {
                                    layer.msg(res.msg, {icon: 4, time: 3000})
                                    return false;
                                }
                                if (res.code != 200) {
                                    layer.msg(res.msg, {icon: 5, time: 3000})
                                    return false;
                                }
                                layer.msg(res.msg, {icon: 1, time: 3000}, function () {
                                    window.location.reload();
                                });
                            }
                        })
                    },
                    cancel: function () {
                        return false;
                    }
                })
                return false;

            })

            form.render();
        });
    </script>
    </body>
@endsection
